package com.it.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

public class Person {

//    @Value("张三")
    private String name;
//    @Value("#{22 -2}")
    private Integer age;
//    @Value("${person.nickname}")
    private String nickname;
    @Autowired
    private Rainbow rainbow;

    public void testinit() {
        System.out.println("----------testinit---------" + rainbow);
        Blue blue = rainbow.getBlue();
        System.out.println(blue);
    }


    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }


    public Person(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public Person(String name, Integer age, String nickname) {
        this.name = name;
        this.age = age;
        this.nickname = nickname;
    }


    public Person() {
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", nickname='" + nickname + '\'' +
                '}';
    }
}
